﻿//-----------------------------------------------------------------------
// <copyright file="GenericEntity.cs" company="ET">
//     Copyright Huirui. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace Huirui.Cavan.Domain.Seedwork
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Huirui.Cavan.Core.Persistent;
    

    /// <summary>
    /// base entity class
    /// </summary>
    /// <typeparam name="TID">The type of the ID.</typeparam>
    [Serializable]
    public abstract partial class Entity<TID> : PersistentObjectWithTypedId<TID>
    {
        #region String representation
        /// <summary>
        /// Returns a <see cref="System.String"/> that represents this instance.
        /// </summary>
        /// <returns>A <see cref="System.String"/> that represents this instance.</returns>
        public override string ToString()
        {
            return "ID: " + Id + " - " + this.ToDisplay();
        }
        #endregion String representation

        #region Override
        /// <summary>
        /// Toes the display.
        /// </summary>
        /// <returns>string value</returns>
        public override string ToDisplay()
        {
            return Id.ToString();
        }

        /// <summary>
        /// Gets the domain object signature.
        /// </summary>
        /// <returns>string value</returns>
        protected override string GetDomainObjectSignature()
        {
            return Id.ToString();
        }
        #endregion
    }
}
